home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-10-13 | 13.0 KB | 288 lines | [TEXT/MPS ] |
- ; Version: 2.2
- ; Created: Wednesday, July 5, 1989 at 4:17:30 PM
- ;
- ; File: FSEqu.a
- ;
- ; Assembler Interface to the Macintosh Libraries
- ; Copyright Apple Computer, Inc. 1984-1989
- ; All Rights Reserved
- ;
- ;--------------------------------------------------------------------
- SigWord EQU $D2D7 ; signature bytes (MFS volume)
- TSigWord EQU $4244 ; signature bytes (HFS volume)
- HFSBit EQU 9 ; defines HFS bit in trap word
- ;_______________________________________________________________________
- ; fixed location labels: (equivalent of zero page)
- FSFCBLen EQU $3F6 ; HFS present flag / FCB size (-1 in old ROM)
- WDRfnMin EQU -32767 ; Lowest assigned WD RefNum
- WDRfnMax EQU -4096 ; largest possible WDrefnum
- HFSTagData EQU $38A ; Room for additional HFS tag data
- FCBSPtr EQU $34E ; ptr to FCBs
- DefVCBPtr EQU $352 ; pointer to default VCB
- VCBQHdr EQU $356 ; VCB queue header
- FSQHdr EQU $360 ; file system queue header (10 bytes)
- FSBusy EQU $360 ; non-zero when the file system is busy
- FSQHead EQU $362 ; ptr to 1st queued cmd: 0 when queue empty
- FSQTail EQU $366 ; ptr to last queue element
-
- ;;;
- ;;; HParamBlockRec Record
- ;;;
- HParamBlockRec RECORD 0
- qLink DS.L 1
- qType DS.W 1
- ioTrap DS.W 1
- ioCmdAddr DS.L 1
- ioCompletion DS.L 1
- ioResult DS.W 1
- ioNamePtr DS.L 1
- ioVRefNum DS.W 1
- ENDR
-
- ;;;
- ;;; HParamBlockRec.fileParam Record
- ;;;
- HFileParam RECORD 24
- ioFRefNum DS.W 1
- ioFVersNum DS.B 1
- filler1 DS.B 1
- ioFDirIndex DS.W 1
- ioFlAttrib DS.B 1
- ioFlVersNum DS.B 1
- ioFlFndrInfo DS.L 4
- ioDirID DS.L 1
- ioFlStBlk DS.W 1
- ioFlLgLen DS.L 1
- ioFlPyLen DS.L 1
- ioFlRStBlk DS.W 1
- ioFlRLgLen DS.L 1
- ioFlRPyLen DS.L 1
- ioFlCrDat DS.L 1
- ioFlMdDat DS.L 1
- HFileParamSize EQU *
- ENDR
-
- ;
- ; Volume Control Block equates: (prefix: VCB)
- ;
- vcbFlags EQU 6 ; flags word is first word after header
- vcbDirty EQU 15 ; flags dirty bit (tst.w tests,clr.b clears)
- ; first 64/104 bytes of VCB come directly from the directory master block
- vcbDInfoSt EQU 8 ; leave room for 6-byte queue header
- vcbDILen EQU 64 ; len of VCB data from master directory (from old FSEQU)
- vcbSigWord EQU 8 ; signature word
- vcbCrDate EQU 10 ; Creation date.
- vcbLsBkUp EQU 14 ; last backup date
- vcbLsMod EQU 14 ; alternate name for above
- vcbAtrb EQU 18 ; volume attributes. bit 15 = vol lock (1=locked)
- ; bit 7 = wr protect
- ; bit 6 = busy (1=busy)
- ; bit 5 = volume consistent if set
- ; (set for default on GetVolInfo)
- ; bits 0-4 = consistency prob
- ; 0: max CNID > VCBNxtCNID
- ; 1: file count error
- ; 2: file length error
- ; 3: catalog B*-tree loop
- ; 4: extent B*-tree loop
- vcbAtVOK EQU 8 ; attrib consistent volume flag (set on clean _Unmount)
- ; (bit 8 in word, bit 0 in top byte)
- vcbWrProt EQU 7 ; attrib write-protected bit (tst.b ATRB+1 tests)
- vcbNmFls EQU 20 ; number files in MFS dir
- ; number files in HFS root dir
- vcbDirSt EQU 22 ; start dir (512-byte) block on diskette (MFS)
- vcbVBMSt EQU 22 ; same as VCBDirSt, starting block of allocation map (HFS) (overlaps)
- vcbBlLn EQU 24 ; length of dir in (512-byte) blocks (MFS)
- vcbAllocPtr EQU 24 ; same as VCBBlLn, Starting block for new file allocations
- vcbNmBlks EQU 26 ; number of blocks (of alloc size) this device
- vcbNmAlBlks EQU 26 ; (alternate label for a while)
- vcbAlBlkSiz EQU 28 ; num of bytes in an allocation block
- vcbClpSiz EQU 32 ; num of bytes to try to alloc as a clump
- vcbAlBlSt EQU 36 ; starting diskette (512-byte) block in block map
- vcbNxtCNID EQU 38 ; next free CNode identifier (HFS)
- vcbNxtFNum EQU 38 ; next free file number (MFS)
- vcbFreeBks EQU 42 ; number of free blocks on this volume
- vcbVN EQU 44 ; volume name (including name length byte)
- vcbMaxNam EQU 27 ; 27 byte max name length
- IOVDirLen EQU vcbVN-vcbCrDate ; Length of info to copy by GetVolInfo
- ;
- ; next 6 fields should be kept together
- ;
- vcbDrvNum EQU 72 ; drive number for this VCB
- vcbDRefNum EQU 74 ; driver refnum for this VCB
- vcbFSID EQU 76 ; ID of file system handling this volume
- vcbVRefNum EQU 78 ; unique refnum for this VCB
- vcbMAdr EQU 80 ; volume map address (FS volume)
- vcbBufAdr EQU 84 ; volume buffer address
- vcbMLen EQU 88 ; length of volume map (FS volume)
- vcbDirIndex EQU 90 ; directory index, block number used for
- vcbDirBlk EQU 92 ; GetFileInfo searches by index
- MFSVCBLen EQU 94 ; Length of MFS VCB
- ;
- ; Volume Control Block (VCB) extensions for HFS copied from Volume Info Block:
- ;
- vcbTDInfoSt EQU 94 ; Start of additional HFS info:
- vcbVolBkUp EQU 94 ; Date volume was last backed up
- vcbVSeqNum EQU 98 ; Index of volume in backup set
- vcbWrCnt EQU 100 ; Volume write count
- vcbXTClpSiz EQU 104 ; Extent B*-Tree clump size
- vcbCTClpSiz EQU 108 ; Catalog B*-Tree clump size
- vcbNmRtDirs EQU 112 ; Number of directories in root
- vcbFilCnt EQU 114 ; Total number of files in volume
- vcbDirCnt EQU 118 ; Total number of directories in volume
- vcbFndrInfo EQU 122 ; Finder info for volume
- vcbVCSize EQU 154 ; Volume cache size in blocks
- vcbVBMCSiz EQU 156 ; Bitmap cache size in blocks
- vcbCtlCSiz EQU 158 ; Extent and Catalog B*-Tree cache size (blocks)
- ;
- ; additional VCB information NOT copied from the MDB:
- ;
- vcbXTAlBks EQU 160 ; Size of extent B*-Tree in allocation blocks
- vcbCTAlBks EQU 162 ; Size of catalog B*-Tree in allocation blocks
- vcbXTRef EQU 164 ; File RefNum for Extent B*-Tree
- vcbCTRef EQU 166 ; File RefNum for Catalog B*-Tree
- vcbCtlBuf EQU 168 ; Pointer to extent desc. and catalog caches
- vcbDirIDM EQU 172 ; Directory last searched: 0 if invalid.
- vcbOffsM EQU 176 ; Offspring index at last search
- vcbLength EQU 178 ; VCB byte length
- ; File Control Block equates: (prefix: FCB)
- fcbModBit EQU 7 ; dirty bit for FCB entry in FCBMdRByt
- fcbOwnClp EQU 6 ; Clump-size specified flag (for truncate on close)
- fcbFilLck EQU 5 ; 1 if file is locked [write-protected]
- fcbShrWrt EQU 4 ; 1 if file is open for shared write access
- fcbWrtLck EQU 2 ; 1 if fork is reserved for write (byte range lock)
- fcbRscBit EQU 1 ; 1 if this is resource part (in FCBMdRByt)
- fcbWrtBit EQU 0 ; write permissions bit in FCBTypByt (1 if ok)
- fcbFlgMBit EQU 15 ; dirty bit in FCBFlags (word)
- fcbFlgCBit EQU 14 ; clump-size spec'd bit in FCBFlags (word)
- fcbFlgPBit EQU 13 ; Write-protected [file lock] bit in FCBFlags (word)
- fcbFlgSBit EQU 12 ; Shared-write bit in FCBFlags (word)
- fcbFlgLBit EQU 10 ; Byte range locked bit in FCBFlags (word)
- fcbFlgRBit EQU 9 ; resource bit in FCBFlags (word)
- fcbFlgWBit EQU 8 ; write permissions bit in FCBFlags (word)
- WrRsMask EQU $0300 ; rsrc/reg, write permissions mask
- PermMask EQU $1300 ; all bits related to access arbitration
- fcbFlNm EQU 0 ; FCB file number. Non-zero marks FCB used.
- fcbFlags EQU 4 ; FCB flags
- fcbMdRByt EQU 4 ; mod, write permissions, resource byte
- fcbTypByt EQU 5 ; type byte
- fcbSBlk EQU 6 ; File start block (in alloc size blks)
- fcbEOF EQU 8 ; logical length or EOF in bytes
- fcbPLen EQU 12 ; Physical file length in bytes
- fcbCrPs EQU 16 ; current position within file.
- ioFIStILen EQU 20 ; Length to straight copy from FCB on _GetFCBInfo
- fcbVPtr EQU 20 ; Absolute pointer to the corresponding VCB
- fcbBfAdr EQU 24 ; file's buffer address.
- fcbFlPos EQU 28 ; directory block this file is in
- MFSFCBLen EQU 30 ; Length of MFS FCB structure
- ;
- ; FCB Extensions for HFS:
- ;
- fcbClmpSize EQU 30 ; Number of bytes per clump
- fcbBTCBPtr EQU 34 ; pointer to B*-Tree control block for this file
- fcbExtRec EQU 38 ; First 3 file extents
- fcbFType EQU 50 ; file's 4 Finder Type bytes
- fcbCatPos EQU 54 ; Catalog hint for use on Close
- fcbDirID EQU 58 ; Parent Directory ID
- fcbCName EQU 62 ; CName of open file
- fcbEntLen EQU 94 ; Length of each element in the FCB array
- ;_______________________________________________________________________
- ;
- ; Directory master block entries: (Prefix Dr)
- ;
- drSigWord EQU 0 ; signature word
- drCrDate EQU 2 ; Creation date.
- drLsMod EQU 6 ; last backup date
- drAtrb EQU 10 ; volume attributes. bit 15=write(locked=1)
- drNmFls EQU 12 ; number files in directory
- drDirSt EQU 14 ; start dir (512-byte) block on diskette
- drVBMSt EQU 14 ; starting sector of allocation map (overlaps)
- drBlLn EQU 16 ; length of dir in (512-byte) blocks
- drAllocPtr EQU 16 ; Start of next allocation search
- drNmAlBlks EQU 18 ; number of blocks (of alloc size) this volume
- drAlBlkSiz EQU 20 ; min num of bytes to allocate (must be 512 mult)
- drClpSiz EQU 24 ; num of bytes to try to alloc as a clump
- drAlBlSt EQU 28 ; starting diskette (512-byte) block in block map
- drNxtCNID EQU 30 ; Next CNode identifier
- drNxtFNum EQU 30 ; next free file number
- drFreeBks EQU 34 ; number of free blocks on this volume
- drVN EQU 36 ; volume name (including name length)
- MpTblStr EQU 64 ; byte start position of map table within
- ; master dir block (MFS volume)
- ;
- ; Master Directory Block extensions for HFS:
- ;
- drTInfoSt EQU 64
- drVolBkup EQU 64 ; Date of last volume backup (overlaps)
- drVSeqNum EQU 68 ; Sequence number of volume within backup set
- drWrCnt EQU 70 ; Volume write count
- drXTClpSiz EQU 74 ; Extent B*-Tree clump size
- drCTClpSiz EQU 78 ; Catalog B*-Tree clump size
- drNmRtDirs EQU 82 ; Number of subdirectories in the root
- drFilCnt EQU 84 ; Total number of files in volume
- drDirCnt EQU 88 ; Total number of directories in volume
- drFndrInfo EQU 92 ; Finder info for volume
- drVCSize EQU 124 ; Volume cache size
- drVBMCSize EQU 126 ; Volume Bitmap cache size
- drCtlCSize EQU 128 ; Size of common volume cache
- ;
- ; length of additional VCB data from master directory block for HFS volumes:
- ;
- vcbTDILen EQU 130-drTInfoSt
- ;
- ; Information not copied into VCB:
- ;
- drXTFlSize EQU 130 ; Length of extent B*-Tree (LEOF and PEOF)
- drXTExtRec EQU 134 ; First (and only) extent-tree extent record
- drCTFlSize EQU 146 ; Length of catalog B*-Tree (LEOF and PEOF)
- drCTExtRec EQU 150 ; First catalog extent record
- LenMDB EQU 162 ; length of full MDB
- drUsrInfo EQU 256 ; User information for volume
- ;_______________________________________________________________________
- ;
- ; File Entry equates: (prefix: Fl)
- ; (delete indication may be needed; for now just check VCB del fnum . . .)
- flWrtFlag EQU 0 ; write-allowed bit in flags byte (0 if allowed)
- flTypMask EQU $FE ; (user file-type in bits 1-7)
- flFlags EQU 0 ; bit 7=1 (used), bit 0=file lock flag
- flTyp EQU 1 ; file type (used as a name extension)
- flUsrWds EQU 2 ; user words for file. (16 bytes)
- flFlNum EQU 18 ; file number
- flStBlk EQU 22 ; Start file block (alloc blk size)(0000 if none)
- flLgLen EQU 24 ; File logical length in bytes (EOF)
- flPyLen EQU 28 ; File physical length in bytes
- flRStBlk EQU 32 ; Start file block, resource fork (0000 if none)
- flRLgLen EQU 34 ; File logical length (EOF), resource fork
- flRPyLen EQU 38 ; File physical length, resource fork
- flCrDat EQU 42 ; File creation date & time (32 bits in seconds)
- flMdDat EQU 46 ; last modification date & time (32 bits in seconds)
- flNam EQU 50 ; file name, starting with length byte
- flNTLen EQU 50 ; length of each file entry, excluding name
- ;_______________________________________________________________________
- ;
- ; Working Directory Control Block equates: (prefix: WD)
- ;
- WDVCBPtr EQU 0 ; pointer to VCB of residing WD (longint)
- WDDirID EQU 4 ; WD directory Identification (longint)
- WDCatHint EQU 8 ; Catalog node hint
- WDProcID EQU 12 ; process that created WD
- WDCBLen EQU 16 ; Length of a WDCB
- ;_______________________________________________________________________
- ;
- ; Poor Man's Search Path equates: (prefix: SP)
- ;
- PMSPHook EQU -6 ; Hook for PMSP modification
- PMSPIndx EQU -2 ; Index to PMSP index from start of PMSP
- SPHdrSize EQU 6 ; Size of negative-offset header
- SPVRefNum EQU 0 ; Offset to VRefNum in PMSP entry
- SPDirID EQU 2 ; Offset to Directory ID in PMSP entry
- SPEntLen EQU 6 ; Length of a PMSP entry
- MaxDVCnt EQU 8 ; Leave room for 8 default VRefNums
- PMSPSize EQU MaxDVCnt*SPEntLen+SPHdrSize+2
- ; Size of PMSP table +header + index word
- ; 31744 = $7C00, a nice round number close to
- ; (32767*1000)/1024, which is about the largest
- ; free space unsuspecting, decimal-K minded apps
- ; might be expected to handle.
- AlBlkLim EQU 31744
-